package 点名;

class Solution {
    public int takeAttendance(int[] records) {
        int left = 0;
        int right = records.length - 1;
        while(left < right){
            int mid = left + (right - left) / 2;
            if(records[mid] > mid){
                right = mid;
            }else{
                left = mid + 1;
            }
        }
        if(records[right] != right){
            return right;
        }
        return records.length;
    }
}